package com.dk.service.impl;

import com.dk.mapper.EvolveReplyMapper;
import com.dk.pojo.EvolveReply;
import com.dk.service.EvolveReplyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class EvolveReplyServiceImpl implements EvolveReplyService {
    @Autowired
    private EvolveReplyMapper evolveReplyMapper;

    @Override
    public List<EvolveReply> getInfo() {
        return evolveReplyMapper.selectByExample(null);
    }

    @Override
    public PageInfo<EvolveReply> show(EvolveReply evolveReply,Integer pageNumber, Integer pageSize) {
        PageHelper.startPage(pageNumber,pageSize);
        List<EvolveReply> list = evolveReplyMapper.selectByEkiKeyId(evolveReply);
        PageInfo<EvolveReply> page = new PageInfo<>(list);
        return page;
    }

    @Override
    public boolean addInfo(EvolveReply evolveReply) {
        return evolveReplyMapper.insert(evolveReply) > 0;
    }

    @Override
    public boolean deleteInfo(Integer id) {
        return evolveReplyMapper.deleteByPrimaryKey(id) > 0;
    }

    @Override
    public EvolveReply toUpdatet(Integer id) {
        return evolveReplyMapper.selectByPrimaryKey(id);
    }

    @Override
    public boolean updateInfo(EvolveReply evolveReply) {
        return evolveReplyMapper.updateByPrimaryKey(evolveReply) > 0;
    }

    @Override
    public Integer getCount() {
        return evolveReplyMapper.countByExample(null);
    }
}
